import 'package:flutter/material.dart';

import 'package:shop/util/http.dart';
import 'package:shop/models/category_data.dart';

class CategoryViewModel extends ChangeNotifier {
  List<CategoryInfo> categoryList = [];
  var selectIndex = 0;
  CategoryInfo? selectInfo;

  void getCategoryData() async {
    final data = await Http.request('/categories');

    categoryList = CategoryData.fromJson(data).message ?? [];
    selectInfo = categoryList.first;

    notifyListeners();
  }
}
